
#include <iostream>
#include<vector>
using namespace std;

typedef long long ll;
int main()
{
    int q, a, b, c;

    vector<ll> v;
    cin >> q;
    while (q--)
    {
        ll score = 0, _min = 0, _score = 0;
        cin >> a >> b >> c;
        _min = min(min(a, b), c);
        score = 2 * _min;
        if (b - _min > 1)
        {
            score += (b - _min - 1);
        }
        v.push_back(score);
    }
    for (auto e : v)
    {
        cout << e << endl;
    }
    return 0;
}